//
//  HTSongCell.m
//  HeartTravel
//
//  Created by lanou on 15/10/29.
//  Copyright © 2015年 陈文杰. All rights reserved.
//

#import "HTSongCell.h"

@implementation HTSongCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH/2 - 20, 30)];
        _nameLabel.textColor = [UIColor whiteColor];
        
        _albumNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2 + 10, 10, SCREEN_WIDTH/2 - 20, 30)];
        _albumNameLabel.textColor = [UIColor whiteColor];
        _albumNameLabel.font = [UIFont systemFontOfSize:12];
        _albumNameLabel.textAlignment = NSTextAlignmentRight;
        _albumNameLabel.numberOfLines = 0;
//        self.backgroundColor = [UIColor colorWithRed:0.357 green:0.429 blue:1.000 alpha:1.000];
        
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 50)];
//        view.backgroundColor = [UIColor whiteColor];
        
        CAGradientLayer *gradientLayer = [CAGradientLayer layer];  // 设置渐变效果
        gradientLayer.bounds = view.bounds;
        gradientLayer.borderWidth = 0;
        
        gradientLayer.frame = view.bounds;
        gradientLayer.colors = [NSArray arrayWithObjects:
                                (id)[[UIColor colorWithRed:0.540 green:0.670 blue:1.000 alpha:0.950] CGColor],
                                (id)[[UIColor clearColor]CGColor], nil];
        gradientLayer.startPoint = CGPointMake(0, 0);
        gradientLayer.endPoint = CGPointMake(1.0, 1.0);
        
        [view.layer insertSublayer:gradientLayer atIndex:0];
        
        [view addSubview:_nameLabel];
        [view addSubview:_albumNameLabel];
        [self.contentView addSubview:view];
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
